# -*- coding: utf-8 -*-
# @Time : 2022-06-13 14:52
# @Author : Z
# @Function : 碧玺后台管理

from Keywords.inter_keys import Inter

inter = Inter()
# 登陆
inter.post_json('https://pos3-gateway.qxfoodom.com/auth/systemV1/username-login',
                '{"password":"Q473E3h3U20XtB8nqJN2FFREwY7FCgZW7cDNvxwgNjFmlptfsc49ryYW1KYS+HnynqXNp2ppvImhlnRhFOQa9Ekf94EITNqnvGxin6dNqBf4Scl5WiU1z6VZGTfYquETtCOey7L03gEz2+5CdAa1sB7IOjL3fLmUBxtdYzET43Y=","name":"15678300490","channelId":"11"}')
inter.assert_equals('code', '0000')
inter.save_json("$.data.accessToken", "newtoken")
# 添加authorization到请求头
inter.add_header('authorization', '{newtoken}')

# 首页
inter.post_json('https://pos3-gateway.qxfoodom.com/manager/menu/list-menu-login', '{}')
# 断言
inter.assert_equals('$.code', '0000')

# 查询订单
inter.post_json('https://pos3-gateway.qxfoodom.com/manager/order/payment-page',
                '{"size":10,"current":1,"channelOrderNo":"","orderId":"1536242564973174786","startTime":"2022-06-13 00:00:00","endTime":"2022-06-13 23:59:59"}')
# 断言
inter.assert_equals('$.code', '0000')

# 退出登录
inter.post_json('https://pos3-gateway.qxfoodom.com/auth/system/login-out')
